package org.devocean.groupbuying.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@SuppressWarnings("serial")
@Entity
public class Formula implements Serializable {

	@Id
	@GeneratedValue
	private Integer formulaID;

	private Integer factor;
	private String frequency;
	private String currency;
	private String choice;
	private Double price;
	private Double discounted;
	private Date date;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "formula")
	private Set<Discount> discount = new HashSet<Discount>();

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "planID", referencedColumnName = "planID", nullable = false)
	private Plan plan;

	public Integer getFormulaID() {
		return formulaID;
	}

	public void setFormulaID(Integer formulaID) {
		this.formulaID = formulaID;
	}

	public Integer getFactor() {
		return factor;
	}

	public void setFactor(Integer factor) {
		this.factor = factor;
	}

	public String getFrequency() {
		return frequency;
	}

	public void setFrequency(String frequency) {
		this.frequency = frequency;
	}

	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public String getChoice() {
		return choice;
	}

	public void setChoice(String choice) {
		this.choice = choice;
	}

	public Set<Discount> getDiscount() {
		return discount;
	}

	public void setDiscount(Set<Discount> discount) {
		this.discount = discount;
	}

	public Plan getPlan() {
		return plan;
	}

	public void setPlan(Plan plan) {
		this.plan = plan;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public String toString() {
		return "Formula [formulaID=" + formulaID + ", factor=" + factor
				+ ", frequency=" + frequency + ", currency=" + currency
				+ ", choice=" + choice + ", price=" + price + "]";
	}

	public Double getDiscounted() {
		return discounted;
	}

	public void setDiscounted(Double discounted) {
		this.discounted = discounted;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

}
